﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;

namespace Microsoft.SocialRecipes
{       
    /// <summary>
    /// Value type for holding HTML5VideoPlayer Column
    /// </summary>
    public class SPFieldHTML5VideoPlayerValue : SPFieldMultiColumnValue
    {
        private const int NumberOfFields = 7;
        
        /// <summary>
        /// Initializes a new instance of the <see cref="SPFieldHTML5VideoPlayerValue"/> class.
        /// </summary>
        /// <param name="fieldValue">A string that specifies the the number of "columns" and the value contained by each. The string consists of delimiter characters (#;) that separate the "column" values, for example, "MyFirstValue#; MySecondValue#;MyThirdValue".</param>
        public SPFieldHTML5VideoPlayerValue(string fieldValue)
            : base(fieldValue)
        { }

        /// <summary>
        /// Initializes a new instance of the <see cref="SPFieldHTML5VideoPlayerValue"/> class.
        /// </summary>
        public SPFieldHTML5VideoPlayerValue()
            : base(NumberOfFields)
        { }

        /// <summary>
        /// Gets or sets the video URL.
        /// </summary>
        /// <value>
        /// The video URL.
        /// </value>
        public string VideoUrl
        {
            get { return this[0]; }
            set { this[0] = value; }
        }

        /// <summary>
        /// Gets or sets the height.
        /// </summary>
        /// <value>
        /// The height.
        /// </value>
        public string Height
        {
            get { return this[1]; }
            set { this[1] = value; }
        }

        /// <summary>
        /// Gets or sets the weight.
        /// </summary>
        /// <value>
        /// The weight.
        /// </value>
        public string Width
        {
            get { return this[2]; }
            set { this[2] = value; }
        }

        /// <summary>
        /// Gets or sets a value indicating whether [show control on display].
        /// </summary>
        /// <value>
        /// 	<c>true</c> if [show control on display]; otherwise, <c>false</c>.
        /// </value>
        public bool ShowMediaControlsOnDisplay
        { 
            get { return Convert.ToBoolean(this [3]);}
            set { this[3] = value.ToString (); }
        }

        /// <summary>
        /// Gets or sets the type of the content.
        /// </summary>
        /// <value>
        /// The type of the content.
        /// </value>
        public string ContentType
        {
            get { return this[4]; }
            set { this[4] = value; }                
        }

        /// <summary>
        /// Gets or sets the associated java script URL.
        /// </summary>
        /// <value>
        /// The associated java script URL.
        /// </value>
        /// <remarks>
        /// This will only register the javascript with the page
        /// </remarks>
        public string AssociatedJavaScriptUrl
        {
            get { return this[5]; }
            set { this[5] = value; }
        }


        /// <summary>
        /// Gets or sets the thumb nail URL.
        /// </summary>
        /// <value>
        /// The thumb nail URL.
        /// </value>
        public string ThumbnailUrl
        {
            get { return this[6]; }
            set { this[6] = value; }
        }
    }
}
